package chen.web;

/**
 *由于很多时候要用到MyContext, 这里提供一个方便获得MyContext的方法.
 */
public class MyContextProvider {
	private static ThreadLocal<MyContext> threadLocal = new ThreadLocal<MyContext>();
	
	/**
	 * 获取当前上下文
	 * @return
	 */
	public static MyContext getMyContext(){
		return threadLocal.get();
	}
	
	/**
	 * 设置当前上下文
	 * @param context
	 */
	static void setMyContext(MyContext context){
		threadLocal.set(context);
	}
	
	static void remove(){
		threadLocal.remove();
	}
	
}
